package frames.kits;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.stereotype.Component;

import java.awt.*;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
@Component
public class BoomButtonListener extends MouseAdapter {
    @Autowired
    private Datas datas;
    private Color color = new Color(10,180,100);

    @Override
    public void mouseClicked(MouseEvent e) {
//        System.out.println(e.getSource().getClass().getName());
        if (e.getSource() instanceof BoomButton){
            BoomButton source =(BoomButton) e.getSource();
            Integer integer = datas.getMat()[source.getDx()][source.getDy()];
            if (integer == -1){
                System.out.println("触碰雷区　游戏结束");
            }
            source.setText(""+integer);
            source.setBackground(color);
        }


    }
}
